<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html>
<head>
    <title>nicePaging</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<?php
// Include class
include("nicePaging.php");

// 
// Connect to database
$con=mysql_connect("localhost", "root", "");
mysql_select_db("db", $con);

// Create instance
$paging=new nicePaging($con);

// Create table
echo '<table border="0" cellspacing="1" cellpadding="3" width="500" align="center" class="table">';
    echo '<tr class="header"><th width="50">ID</th><th width="450">Title</th></tr>';
    
    $page=isset($_GET['page']) ? $_GET['page'] : 1; // Current page    
    $rowsPerPage=10; // Rows per page
    
    // Pager query
    $result=$paging->pagerQuery("SELECT id, title FROM sample", $page, $rowsPerPage);
    while($data=mysql_fetch_assoc($result)){
	// Display row
	echo '<tr class="row"><td>'.$data['id'].'</td><td>'.$data['title'].'</td></tr>';
    }
echo '<table>';

$link="index.php"; // Page name
$conjunction="?"; //Conjunction between page name and query string for page number
$maxPages=5; //Number of paging links that will be displayed

// Create link for paging
echo $paging->createPaging($link, $conjunction, $maxPages);

// Close database connection
mysql_close($con);
?>
</body>
</html>